package com.huayi.server.NioServer;

import com.huayi.server.Entity.DeviceEntity;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * Created by mac on 2017/8/15.
 */
public class Message  {

    /**
     *  1   CONTROL
     *      SERVER 下发控制命令，控制电磁阀的开和关
     *  2   REPORT
     *      ROOT 向 SERVER 汇报所有节点状态和传感器值
     *  3   CONFIG
     *      SERVER 向 ROOT 下发配置信息
     *  4   LOGIN
     *      ROOT 登录 SERVER
     */
    public static int CONTROL = 1;
    public static int REPORT = 2;
    public static int CONFIG = 3;
    public static int LOGIN = 4;

    private int len;
    private int key;
    private int ack;
    private int api;
    private int data_len;
    private String deviceid;
    private String devicepass;
    private List<DeviceEntity> devicelist;
    private int crc;

    public int getLen() {
        return len;
    }

    public void setLen(int len) {
        this.len = len;
    }

    public int getKey() {
        return key;
    }

    public void setKey(int key) {
        this.key = key;
    }

    public int getAck() {
        return ack;
    }

    public void setAck(int ack) {
        this.ack = ack;
    }

    public int getApi() {
        return api;
    }

    public void setApi(int api) {
        this.api = api;
    }

    public int getData_len() {
        return data_len;
    }

    public void setData_len(int data_len) {
        this.data_len = data_len;
    }

    public int getCrc() {
        return crc;
    }

    public String getDeviceid() {
        return deviceid;
    }

    public void setDeviceid(String deviceid) {
        this.deviceid = deviceid;
    }

    public String getDevicepass() {
        return devicepass;
    }

    public void setDevicepass(String devicepass) {
        this.devicepass = devicepass;
    }

    public List<DeviceEntity> getDevicelist() {
        return devicelist;
    }

    public void setDevicelist(List<DeviceEntity> devicelist) {
        this.devicelist = devicelist;
    }

    public void setCrc(int crc) {
        this.crc = crc;
    }

    public static void main(String[] args){
        return;
    }

    @Override
    public String toString() {
        return "Message{" +
                "len=" + len +
                ", key=" + key +
                ", ack=" + ack +
                ", api=" + api +
                ", data_len=" + data_len +
                ", deviceid='" + deviceid + '\'' +
                ", devicepass='" + devicepass + '\'' +
                ", devicelist=" + devicelist +
                ", crc=" + crc +
                '}';
    }
}
